package com.jh.fcsm.controller.inf;

import com.github.pagehelper.PageInfo;
import com.jh.fcsm.beans.inf.InfLogRecord;
import com.jh.fcsm.beans.inf.vo.InfLogRecordVo;
import com.jh.fcsm.common.BaseController;
import com.jh.fcsm.common.RestApiResponse;
import com.jh.fcsm.service.inf.InfLogRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 接口日志记录Controller
 *
 * @author linqiang
 * @date 2022-03-01 12:54:48
 */
@RestController
@RequestMapping("/inf/log")
@Api(value="接口日志记录", tags ="接口日志记录")
public class InfLogRecordController extends BaseController {
    @Autowired
    private InfLogRecordService infLogRecordService;

	private static final String PER_PREFIX = "btn:inf:log:";

//	/**
//	 *@Description: 查询接口日志记录详情
//	 *@param id
//	 *@return RestApiResponse<?>
//	 *@Author: linqiang
//	 */
//	@GetMapping("/findById")
//	@ApiOperation(value = "查询接口日志记录详情", notes = "查询接口日志记录详情")
//	@PreAuthorize("hasAuthority('" + PER_PREFIX + "find')")
//	public RestApiResponse<?> findById(@RequestParam("id") String id) {
//		InfLogRecord infLogRecord=infLogRecordService.findById(id);
//		return RestApiResponse.ok(infLogRecord);
//	}

	/**
	 *@Description: 分页查询接口日志记录
	 *@param infLogRecordVo 接口日志记录 查询条件
	 *@return RestApiResponse<?>
	 *@Author: linqiang
	 */
	@PostMapping("/findPageByQuery")
	@ApiOperation(value = "分页查询接口日志记录", notes = "分页查询接口日志记录")
	@PreAuthorize("hasAuthority('" + PER_PREFIX + "query')")
	public RestApiResponse<?> findPageByQuery(@RequestBody InfLogRecordVo infLogRecordVo) {
		PageInfo<InfLogRecord> infLogRecord=infLogRecordService.findPageByQuery(infLogRecordVo);
		return RestApiResponse.ok(infLogRecord);
	}

}
